export function getCommision (options) {
  return window.fetch({
    method: 'POST',
    url: '/commision/merge',
    data: {
      suppliersId: options.suppliersId || null,
      hotelId: options.hotelId || null,
      roomId: options.roomId || null,
      commisionID: options.commisionID || null,
      calculate: options.calculate || null,
      commision: options.commision || null
    }
  })
}

export function getCompanyInformation (options) {
  return window.fetch({
    method: 'POST',
    url: '/admin/company/info'
  })
}

export function setCompanyInformation (options) {
  return window.fetch({
    method: 'POST',
    url: '/system/company/update',
    data: {
      id: options.id || null,
      companyBaseInfo: options.companyBaseInfo || {},
      financeInfo: options.financeInfo || {},
      suppliersCompanyContacts: options.suppliersCompanyContacts || []
    }
  })
}

export function getQiniuPublicToken (options) {
  return window.fetch({
    method: 'POST',
    url: '/common/qninfo/get',
    data: {
      bucket: 'easytrip-public',
      type: '1',
      key: window.commo.uuid + '_' + options.file.name
    }
  })
}

export function getUuid (options) {
  return window.fetch({
    method: 'GET',
    url: '/common/uuid'
  })
}

export function updateQiniu (options) {
  return window.$http({
    method: 'POST',
    url: 'http://upload-z2.qiniu.com',
    data: options
  })
}

export function getSuppliersList (data) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/list',
    data
  })
}

export function updateSuppliersState (options) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/updatestate',
    data: options
  })
}

export function getSuppliersInformation (data) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/select',
    data
  })
}

//
export function setModeRoleFun(data) {
  return window.fetch({
    method: 'POST',
    url: '/supplier/role/setfunc',
    data:data
  })
}
//获取模式权限列表
export function getModeRoleFunlist (id) {
  return window.fetch({
    method: 'POST',
    url: '/supplier/role/funclist',
    data:id
  })
}
// 查询所有角色
export function getRoleList (options) {
  return window.fetch({
    method: 'POST',
    url: '/admin/role/list'
  })
}

export function resetPassword (options) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/resetpwd',
    data: {
      id: options.userId || null
    }
  })
}

export function updateSuppliers (data) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/update',
    data
  })
}

export function addSuppliers (data) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/add',
    data
  })
}

export function getAccount (options) {
  return window.fetch({
    method: 'POST',
    url: '/admin/account/get'
  })
}

export function getDeptstaffAll (options) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/selectalldept'
  })
}

export function getDeptstaff (options) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/selectalldept'
  })
}

export function updateAccount (options) {
  return window.fetch({
    method: 'POST',
    url: '/admin/account/update',
    data: options
  })
}

export function accountSetPassword (options) {
  return window.fetch({
    method: 'POST',
    url: '/admin/user/pwd',
    data: options
  })
}

export function getStaffList (options) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/stafflist',
    data: options
  })
}

export function setStaffState (options) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/enablestaff',
    data: options
  })
}

export function getStaffAll (options) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/getstaff',
    data: {
      id: parseInt(sessionStorage.getItem('accountID'))
    }
  })
}

export function updateStaff (options) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/updatestaff',
    data: options
  })
}

export function addStaff (options) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/addstaff',
    data: options
  })
}

export function getRoleTheFunclist (options) {
  return window.fetch({
    method: 'POST',
    url: '/admin/role/funclist',
    data: options
  })
}

export function deleteRole (options) {
  return window.fetch({
    method: 'POST',
    url: '/admin/role/delete',
    data: options
  })
}

// 设置角色对应的菜单功能
export function setRoleTheFunclist (options) {
  return window.fetch({
    method: 'POST',
    url: '/admin/role/setmenu',
    data: options
  })
}

export function deleteDept (options) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/deletedept',
    data: options
  })
}

export function addRole (options) {
  return window.fetch({
    method: 'POST',
    url: '/admin/role/add',
    data: {
      name: options.nameValue
    }
  })
}

export function updateRole (options) {
  return window.fetch({
    method: 'POST',
    url: '/admin/role/update',
    data: options
  })
}

export function updateDeptName (options, r, q) {
  return window.fetch({
    method: 'POST',
    url: '/deptstaff/deptname',
    data: {
      adminCompanyId: parseInt(sessionStorage.getItem('companyId')),
      deptName: options.nameValue,
      superiorDept: r,
      deptId: q
    }
  })
}

// token过期验证
export function isToken () {
  return window.fetch({
    method: 'GET',
    url: '/admin/token'
  })
}

/// 查询角色所拥有的功能菜单
export function getcommRoles (options) {
  return window.fetch({
    method: 'POST',
    url: ' deptstaff/funclist',
    data: options
  })
}

//  获取酒店名称集
export function getHotelsList (id) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/hotels',
    data:id
  })
}

//  上传供应商
export function logo (data) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/logo',
    data: data
  })
}


//  查看销售政策 

export function getSellInfo (id) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/sell/info',
    data: id
  })
}

//  修改酒店政策

export function setHotelSell (data) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/sell/hotel',
    data: data
  })
}

//  修改第三方政策

export function setThirdSell (data) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/sell/third',
    data: data
  })
}


//  开户银行 
export function getBankList () {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/bank'
  })
}

// 通过省市银行获取支行
export function getBranchBankList(data){
  return window.fetch({
    method: 'POST',
    url: '/yop/branch',
    data
  })
}